/*
 * Copyright (C) 2008 Universidade Federal de Campina Grande
 *  
 * This file is part of OurGrid. 
 *
 * OurGrid is free software: you can redistribute it and/or modify it under the
 * terms of the GNU Lesser General Public License as published by the Free 
 * Software Foundation, either version 3 of the License, or (at your option) 
 * any later version. 
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * for more details. 
 * 
 * You should have received a copy of the GNU Lesser General Public License 
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 * 
 */
package org.ourgrid.acceptance.worker;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.io.File;
import java.util.Map;

import org.junit.Before;
import org.junit.Test;
import org.ourgrid.acceptance.util.WorkerAcceptanceUtil;
import org.ourgrid.acceptance.util.worker.Req_004_Util;
import org.ourgrid.acceptance.util.worker.Req_006_Util;
import org.ourgrid.acceptance.util.worker.Req_079_Util;
import org.ourgrid.acceptance.util.worker.Req_082_Util;
import org.ourgrid.acceptance.util.worker.Req_090_Util;
import org.ourgrid.acceptance.util.worker.Req_091_Util;
import org.ourgrid.acceptance.util.worker.Req_092_Util;
import org.ourgrid.acceptance.util.worker.Req_095_Util;
import org.ourgrid.acceptance.util.worker.Req_121_Util;
import org.ourgrid.common.interfaces.Worker;
import org.ourgrid.common.interfaces.WorkerClient;
import org.ourgrid.common.interfaces.management.RemoteWorkerManagementClient;
import org.ourgrid.common.interfaces.management.WorkerManagementClient;
import org.ourgrid.common.interfaces.to.WorkerStatus;
import org.ourgrid.common.util.JavaFileUtil;
import org.ourgrid.reqtrace.ReqTest;
import org.ourgrid.worker.WorkerComponent;
import org.ourgrid.worker.WorkerConfiguration;

import br.edu.ufcg.lsd.commune.identification.ContainerID;
import br.edu.ufcg.lsd.commune.identification.DeploymentID;

@ReqTest(reqs="REQ082")
public class Req_082_Test extends WorkerAcceptanceTestCase {
	
	private DeploymentID peerID;
	private Req_004_Util req_004_Util = new Req_004_Util(getComponentContext());
	private Req_090_Util req_090_Util = new Req_090_Util(getComponentContext());
	private Req_092_Util req_092_Util = new Req_092_Util(getComponentContext());
	private Req_095_Util req_095_Util = new Req_095_Util(getComponentContext());
	private Req_079_Util req_079_Util = new Req_079_Util(getComponentContext());
	private Req_006_Util req_006_Util = new Req_006_Util(getComponentContext());
	private Req_121_Util req_121_Util = new Req_121_Util(getComponentContext());
	private Req_091_Util req_091_Util = new Req_091_Util(getComponentContext());
	private Req_082_Util req_082_Util = new Req_082_Util(getComponentContext());
	
	@Before
	public void setUp() throws Exception {
		super.setUp();
		String peerPubKey = workerAcceptanceUtil.simulateAuthentication();
		
		peerID = new DeploymentID(new ContainerID("peerUser", "peerServer", "peerModule", peerPubKey), "peerObj");
		
	}
	
	/**
	 *    1. Start a Worker with the idleness detector DISABLED;
	 *    2. The master peer sends a setPeer message to the Worker;
	 *           * Verify if the following info message was logged: The peer [peerID] set itself as manager of this Worker.
	 *           * Expect the Worker to send a status changed message to the peer, with the IDLE status
	 *    3. The master peer commands the Worker to work for the client with the public key "mgPublicKey1";
	 *           * Verify if the following info message was logged: "Peer commanded this Worker to work for a local consumer. Local consumer public key: [mgPublicKey1]."
	 *           * Verify if the following debug message was logged: "Status changed from IDLE to ALLOCATED_FOR_MYGRID."
	 *           * Expect the Worker to send the peer an allocated for mygrid status changed message, with a stub to the Worker remote object
	 *    4. A client with the public key "mgPublicKey222" sends a getFileInfo message, requesting info about the "$STORAGE" directory;
	 *           * Verify if the following warn message was logged: An unknown client tried to get info about the file [$STORAGE]. This message was ignored. Unknown client public key: [mgPublicKey222].
	 *    5. A client with the public key "mgPublicKey222" sends a getFileInfo message, requesting info about the file "file";
	 *           * Verify if the following warn message was logged: An unknown client tried to get info about the file [file]. This message was ignored. Unknown client public key: [mgPublicKey222].
	 *    6. The master peer commands the Worker to work for the client with the public key "publicKeyABC";
	 *           * Verify if the following info message was logged: "Peer commanded this Worker to work for a local consumer. Local consumer public key: [publicKeyABC]."
	 *           * Expect the Worker to send the peer an allocated for mygrid status changed message, with a stub to the Worker remote object
	 *    7. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE" directory;
	 *           * Verify if the following warn message was logged: An unknown client tried to get info about the file [$STORAGE]. This message was ignored. Unknown client public key: [mgPublicKey1].
	 *    8. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the file "file";
	 *           * Verify if the following warn message was logged: An unknown client tried to get info about the file [file]. This message was ignored. Unknown client public key: [mgPublicKey1].
	 *    
	 */
	@ReqTest(test=" AT-082.1", reqs="REQ082")
	@Test public void test_at_082_1_UnknownLocalClientTriesToRecoverFileInformation() throws Exception {
		// Start worker without idleness detector
		WorkerComponent component = req_004_Util.startWorker();
		
		// Master peer sends a setPeer message - expect an info to be logged
		WorkerManagementClient wmc = req_090_Util.setKnownPeer(component, peerID, WorkerStatus.IDLE);
		
		// Master peer sends a workForMyGrid [mgPubKey] message - expect an info and a debug to be logged
		String mgPubKey1 = "mgPubKey1";
		req_092_Util.workForMyGridOnIdleWorker(component, wmc, mgPubKey1);
		req_092_Util.beginAllocationCompleted(component, wmc);
		
		// Client [mgPubKey222] sends a getFileInfo [$STORAGE] message - expect a warn to be logged
		String unknownClientPubKey = "mgPubKey222";
		req_082_Util.getFileInfoByUnknownClient(component, "$STORAGE", unknownClientPubKey);
		
		// Client [mgPubKey222] sends a getFileInfo [file] message - expect a warn to be logged
		req_082_Util.getFileInfoByUnknownClient(component, "file", unknownClientPubKey);
		
		// Master peer sends a workForMyGrid [pubKeyABC] message - expect an info and a debug to be logged
		req_092_Util.workForMyGridOnAllocatedForMyGridWorker(component, wmc, "pubKeyABC");
		req_092_Util.beginAllocationCompleted(component, wmc);
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE] message - expect a warn to be logged
		req_082_Util.getFileInfoByUnknownClient(component, "$STORAGE", mgPubKey1);
		
		// Client [mgPubKey1] sends a getFileInfo [file] message - expect a warn to be logged
		req_082_Util.getFileInfoByUnknownClient(component, "file", mgPubKey1);
	}
	
	/**
	 *    1. Start a Worker with the idleness detector DISABLED;
	 *    2. The master peer sends a setPeer message to the Worker;
	 *           * Verify if the following info message was logged: The peer [peerID] set itself as manager of this Worker.
	 *           * Expect the Worker to send a status changed message to the peer, with the IDLE status
	 *    3. The master peer sends a workForPeer message to the Worker;
	 *           * Verify if the following info message was logged: "Peer commanded this Worker to work for a remote peer. Remote peer public key: [peerPubKey]."
	 *           * Verify if the following debug message was logged: "Status changed from IDLE to ALLOCATED_FOR_PEER."
	 *           * Expect the Worker to send the peer an allocated for peer status changed message, with a stub to the Remote Worker Management remote object
	 *    4. The remote peer with the public key "peerPubKey" commands the Worker to work for the remote client with the public key "mgPublicKey1";
	 *           * Verify if the following info message was logged: "Remote peer commanded this Worker to work for a remote consumer. Remote consumer public key: [mgPublicKey1]."
	 *           * Verify if the following debug message was logged: "Status changed from ALLOCATED_FOR_PEER to ALLOCATED_FOR_MYGRID."
	 *           * Expect the Worker to send the remote peer an allocated for mygrid status changed message, with a stub to the Worker remote object
	 *    5. A client with the public key "mgPublicKey222" sends a getFileInfo message, requesting info about the "$STORAGE" directory;
	 *           * Verify if the following warn message was logged: An unknown client tried to get info about the file [$STORAGE]. This message was ignored. Unknown client public key: [mgPublicKey222].
	 *    6. A client with the public key "mgPublicKey222" sends a getFileInfo message, requesting info about the file "file";
	 *           * Verify if the following warn message was logged: An unknown client tried to get info about the file [file]. This message was ignored. Unknown client public key: [mgPublicKey222].
	 *    7. The remote peer with the public key "peerPubKey" commands the Worker to work for the remote client with the public key "mgPublicKeyABC";
	 *           * Verify if the following info message was logged: "Remote peer commanded this Worker to work for a remote consumer. Remote consumer public key: [mgPublicKeyABC]."
	 *           * Expect the Worker to send the remote peer an allocated for mygrid status changed message, with a stub to the Worker remote object
	 *    8. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE" directory;
	 *           * Verify if the following warn message was logged: An unknown client tried to get info about the file [$STORAGE]. This message was ignored. Unknown client public key: [mgPublicKey1].
	 *    9. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the file "file";
	 *           * Verify if the following warn message was logged: An unknown client tried to get info about the file [file]. This message was ignored. Unknown client public key: [mgPublicKey1].
	 * 
	 */
	@ReqTest(test=" AT-082.2", reqs="REQ082")
	@Test public void test_at_082_2_UnknownRemoteClientTriesToRecoverFileInformation() throws Exception {
		// Start worker without idleness detector
		WorkerComponent component = req_004_Util.startWorker();
		
		// Master peer sends a setPeer message - expect an info to be logged
		WorkerManagementClient wmc = req_090_Util.setKnownPeer(component, peerID, WorkerStatus.IDLE);
		
		// Master peer sends workForPeer [peerPubKey] message - expect an info and a debug to be logged
		String remPeerPubKey = "peerPubKey";
		req_006_Util.workForPeerOnIdleWorker(component, wmc, peerID.getPublicKey(), remPeerPubKey);
		
		// Remote peer [peerPubKey] sends a workForMyGrid [mgPubKey1] message - expect an info and a debug to be logged
		String mgPubKey = "mgPubKey1";
		RemoteWorkerManagementClient rwmc = req_121_Util.workForMyGridOnAllocatedForPeerWorker(component, remPeerPubKey, mgPubKey);
		req_121_Util.beginAllocationCompleted(component, rwmc);
		
		// Client [mgPubKey222] sends a getFileInfo [$STORAGE] message - expect a warn to be logged
		String unknownClientPubKey = "mgPubKey222";
		req_082_Util.getFileInfoByUnknownClient(component, "$STORAGE", unknownClientPubKey);
		
		// Client [mgPubKey222] sends a getFileInfo [file] message - expect a warn to be logged
		req_082_Util.getFileInfoByUnknownClient(component, "file", unknownClientPubKey);
		
		// Remote peer [peerPubKey] sends a workForMyGrid [mgPubKeyABC] message - expect an info to be logged
		req_092_Util.workForMyGridOnAllocatedForMyGridWorker(component, wmc, "pubKeyABC");
		req_092_Util.beginAllocationCompleted(component, wmc);
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE] message - expect a warn to be logged
		req_082_Util.getFileInfoByUnknownClient(component, "$STORAGE", mgPubKey);
		
		// Client [mgPubKey1] sends a getFileInfo [file] message - expect a warn to be logged
		req_082_Util.getFileInfoByUnknownClient(component, "file", mgPubKey);
	}
	
	/**
	 *    1. Start a Worker with the idleness detector DISABLED and the storage root property set to a read-only directory;
	 *    2. The master peer sends a setPeer message to the Worker;
	 *           * Verify if the following info message was logged: The peer [peerID] set itself as manager of this Worker.
	 *           * Expect the Worker to send a status changed message to the peer, with the IDLE status
	 *    3. Get Worker complete status;
	 *           * Verify if the storage directory is null
	 *    4. The master peer commands the Worker to work for the client with the public key "mgPublicKey1";
	 *           * Verify if the following info message was logged: "Peer commanded this Worker to work for a local consumer. Local consumer public key: [mgPublicKey1]."
	 *           * Verify if the following debug message was logged: "Status changed from IDLE to ALLOCATED_FOR_MYGRID."
	 *           * Expect the Worker to send the peer an allocated for mygrid status changed message, with a stub to the Worker remote object
	 *    5. Get Worker complete status;
	 *           * Verify if the storage directory is null
	 *    6. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE" directory;
	 *           * Verify if the following debug message was logged: "The client requested info about the file [$STORAGE], but this Worker was not commanded to start the work yet. This message was ignored. Client public key: [mgPublicKey1]."
	 *    7. Get Worker complete status;
	 *           * Verify if the storage directory is null
	 *    8. A client with the public key "mgPublicKey1" sends a startWork message;
	 *           * Verify if the following error message was logged: The client [clientID] tried to start the work of this Worker, but the storage directory cannot be created.
	 *           * Expect the Worker to send the client an error ocurred message with the IO_ERROR type
	 *    9. Get Worker complete status;
	 *           * Verify if the storage directory is null
	 *   10. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE" directory;
	 *           * Verify if the following debug message was logged: "The client requested info about the file [$STORAGE], but this Worker was not commanded to start the work yet. This message was ignored. Client public key: [mgPublicKey1]."
	 * 
	 */
	@ReqTest(test=" AT-082.3", reqs="REQ082")
	@Test public void test_at_082_3_LocalClientWhichDidNotStartWorkTriesToRecoverFileInformation() throws Exception {
		// Creating the storage directory and setting it as read-only
		WorkerAcceptanceUtil.createDirectory(WorkerAcceptanceUtil.DEF_INVALID_STORAGE_ROOT_PATH, true);
		
		long tickA = System.currentTimeMillis();
		
		// Start worker without idleness detector
		WorkerComponent component = req_004_Util.startWorker(false, false, true);
		
		
		// Master peer sends a setPeer message - expect an info to be logged
		WorkerManagementClient wmc = req_090_Util.setKnownPeer(component, peerID, WorkerStatus.IDLE);
		
		//getting file properties at worker.properties;
		Map<String, String> properties = component.getContainer().getContext().getProperties();

		//getting path dir
		String playpenDir = properties.get(WorkerConfiguration.ATT_PLAYPEN_ROOT);
		String storageDir = properties.get(WorkerConfiguration.ATT_STORAGE_DIR);

		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.IDLE, playpenDir, storageDir, tickA);
		
		// Master peer sends a workForMyGrid [mgPubKey1] message - expect an info and a debug to be logged
		String mgPubKey = "mgPubKey1";
		req_092_Util.workForMyGridOnIdleWorker(component, wmc, mgPubKey);
		Worker worker = req_092_Util.beginAllocationCompleted(component, wmc);
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.ALLOCATED_FOR_BROKER, playpenDir, storageDir, tickA);
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE] message - expect a warn to be logged
		req_082_Util.getFileInfoByClientWithoutStartingWork(component, "$STORAGE", mgPubKey);
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.ALLOCATED_FOR_BROKER, playpenDir, storageDir, tickA);
		
		// Client [mgPubKey1] sends a startWork message - expect an error to be logged
		DeploymentID myGridID = new DeploymentID(new ContainerID("mgUserName", "mgServer", "mgModule", mgPubKey), "myGrid");
		
		req_079_Util.startWorkWithStorageError(component, worker, myGridID, WorkerAcceptanceUtil.DEF_INVALID_STORAGE_ROOT_PATH);
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.ALLOCATED_FOR_BROKER, playpenDir, storageDir, tickA);
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE] message - expect a warn to be logged
		req_082_Util.getFileInfoByClientWithoutStartingWork(component, "$STORAGE", mgPubKey);
	}

	/**
	 *    1. Start a Worker with the idleness detector DISABLED and the storage root property set to a read-only directory;
	 *    2. The master peer sends a setPeer message to the Worker;
	 *           * Verify if the following info message was logged: The peer [peerID] set itself as manager of this Worker.
	 *           * Expect the Worker to send a status changed message to the peer, with the IDLE status
	 *    3. The master peer sends a workForPeer message to the Worker;
	 *           * Verify if the following info message was logged: "Peer commanded this Worker to work for a remote peer. Remote peer public key: [peerPubKey]."
	 *           * Verify if the following debug message was logged: "Status changed from IDLE to ALLOCATED_FOR_PEER."
 	 *           * Expect the Worker to send the peer an allocated for peer status changed message, with a stub to the Remote Worker Management remote object
	 *    4. Get Worker complete status;
	 *           * Verify if the storage directory is null
	 *    5. The remote peer with the public key "peerPubKey" commands the Worker to work for the remote client with the public key "mgPublicKey1";
	 *           * Verify if the following info message was logged: "Remote peer commanded this Worker to work for a remote consumer. Remote consumer public key: [mgPublicKey1]."
	 *           * Verify if the following debug message was logged: "Status changed from ALLOCATED_FOR_PEER to ALLOCATED_FOR_MYGRID."
	 *           * Expect the Worker to send the remote peer an allocated for mygrid status changed message, with a stub to the Worker remote object
	 *    6. Get Worker complete status;
	 *           * Verify if the storage directory is null
	 *    7. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE" directory;
	 *           * Verify if the following debug message was logged: "The client requested info about the file [$STORAGE], but this Worker was not commanded to start the work yet. This message was ignored. Client public key: [mgPublicKey1]."
	 *    8. Get Worker complete status;
	 *           * Verify if the storage directory is null
	 *    9. A client with the public key "mgPublicKey1" sends a startWork message;
	 *           * Verify if the following error message was logged: The client [clientID] tried to start the work of this Worker, but the storage directory cannot be created.
	 *           * Expect the Worker to send the client an error ocurred message with the IO_ERROR type
	 *   10. Get Worker complete status;
	 *           * Verify if the storage directory is null
	 *   11. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE" directory;
 	 *           * Verify if the following debug message was logged: "The client requested info about the file [$STORAGE], but this Worker was not commanded to start the work yet. This message was ignored. Client public key: [mgPublicKey1]."
 	 *          
	 */
	@ReqTest(test=" AT-082.4", reqs="REQ082")
	@Test public void test_at_082_4_RemoteClientWhichDidNotStartWorkTriesToRecoverFileInformation() throws Exception {
		// Creating the storage directory
		WorkerAcceptanceUtil.createDirectory(WorkerAcceptanceUtil.DEF_STORAGE_ROOT_PATH, true);
		long tickA = System.currentTimeMillis();
		
		// Start worker without idleness detector
		WorkerComponent component = req_004_Util.startWorker(false, false, true);
		
		// Master peer sends a setPeer message - expect an info to be logged
		WorkerManagementClient wmc = req_090_Util.setKnownPeer(component, peerID, WorkerStatus.IDLE);
		
		// Master peer sends workForPeer [peerPubKey] message - expect an info and a debug to be logged
		String remPeerPubKey = "peerPubKey";
		req_006_Util.workForPeerOnIdleWorker(component, wmc, peerID.getPublicKey(), remPeerPubKey);
		
		//getting file properties at worker.properties;
		Map<String, String> properties = component.getContainer().getContext().getProperties();

		//getting path dir
		String playpenDir = properties.get(WorkerConfiguration.ATT_PLAYPEN_ROOT);
		String storageDir = properties.get(WorkerConfiguration.ATT_STORAGE_DIR);
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.ALLOCATED_FOR_PEER, playpenDir, storageDir, tickA);
		
		// Remote peer [peerPubKey] sends a workForMyGrid [mgPubKey1] message - expect an info and a debug to be logged
		String mgPubKey = "mgPubKey1";
		RemoteWorkerManagementClient rwmc = req_121_Util.workForMyGridOnAllocatedForPeerWorker(component, remPeerPubKey, mgPubKey);
		Worker worker = req_121_Util.beginAllocationCompleted(component, rwmc);
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.ALLOCATED_FOR_BROKER, playpenDir, storageDir, tickA);
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE] message - expect a warn to be logged
		req_082_Util.getFileInfoByClientWithoutStartingWork(component, "$STORAGE", mgPubKey);
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.ALLOCATED_FOR_BROKER, playpenDir, storageDir, tickA);
		
		// Client [mgPubKey1] sends a startWork message - expect an error to be logged
		DeploymentID myGridID = new DeploymentID(new ContainerID("mgUserName", "mgServer", "mgModule", mgPubKey), "myGrid");
		
		req_079_Util.startWorkWithStorageError(component, worker, myGridID, WorkerAcceptanceUtil.DEF_STORAGE_ROOT_PATH);
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.ALLOCATED_FOR_BROKER, playpenDir, storageDir, tickA);
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE] message - expect a warn to be logged
		req_082_Util.getFileInfoByClientWithoutStartingWork(component, "$STORAGE", mgPubKey);
	}

	/**
	 *    1. Start a Worker with the idleness detector DISABLED;
	 *    2. The master peer sends a setPeer message to the Worker;
	 *           * Verify if the following info message was logged: The peer [peerID] set itself as manager of this Worker.
	 *           * Expect the Worker to send a status changed message to the peer, with the IDLE status
	 *    3. Get Worker complete status;
	 *           * Verify if the storage directory is null
	 *    4. The master peer commands the Worker to work for the client with the public key "mgPublicKey1";
	 *           * Verify if the following info message was logged: "Peer commanded this Worker to work for a local consumer. Local consumer public key: [mgPublicKey1]."
	 *           * Verify if the following debug message was logged: "Status changed from IDLE to ALLOCATED_FOR_MYGRID."
	 *           * Expect the Worker to send the peer an allocated for mygrid status changed message, with a stub to the Worker remote object
	 *    5. Verify if the "storageRoot/mgPublicKey1Hash" directory does not exist
	 *    6. Get Worker complete status;
	 *           * Verify if the storage directory is null
	 *    7. A client with the public key "mgPublicKey1" sends a startWork message;
	 *           * Verify if the following info message was logged: Worker is ready to start working for client [ClientID1].
	 *           * Expect the Worker to send the client a Worker is Ready message
	 *    8. Verify if the "storageRoot/mgPublicKey1Hash" directory exists
	 *    9. Get Worker complete status;
	 *           * Verify if the storage directory is "storageRoot/mgPublicKey1Hash"
	 *   10. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "." file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash" and md5sum "0"
	 *   11. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash" and md5sum "0"
	 *   12. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "/etc/hosts" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/etc/hosts]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/etc/hosts" and md5sum "0"
	 *   13. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE/root/.bashrc" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/root/.bashrc]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/root/.bashrc" and md5sum "0"
	 *   14. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "test_082_1.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/test_082_1.txt]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/test_082_1.txt" and md5sum "0"
	 *   15. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE/test_082_1.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/test_082_1.txt]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/test_082_1.txt" and md5sum "0"
	 *   16. Copy the file test_082_1.txt, with md5sum value "X", to storageRoot/mgPublicKey1Hash directory
	 *   17. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE/test_082_1.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/test_082_1.txt]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/test_082_1.txt" and md5sum "X"
	 *   18. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "test_082_1.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/test_082_1.txt]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/test_082_1.txt" and md5sum "X"
	 *   19. Get Worker complete status;
	 *           * Verify if the storage directory is "storageRoot/mgPublicKey1Hash"
	 *   20. The master peer commands the Worker to work for the client with the public key "mgPublicKey2";
	 *           * Verify if the following info message was logged: "Peer commanded this Worker to work for a local consumer. Local consumer public key: [mgPublicKey2]."
	 *           * Verify if the following debug message was logged: "Cleaning worker."
	 *           * Expect the Worker to send the peer an allocated for mygrid status changed message, with a stub to the Worker remote object
	 *   21. Get Worker complete status;
	 *           * Verify if the storage directory is "null"
	 *   22. Verify if the "storageRoot/mgPublicKey1Hash" directory still exists
	 *   23. Verify if the "storageRoot/mgPublicKey2Hash" directory does not exist
	 *   24. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "$STORAGE" file;
	 *           * Verify if the following debug message was logged: "The client requested info about the file [$STORAGE], but this Worker was not commanded to start the work yet. This message was ignored. Client public key: [mgPublicKey1]."
	 *   25. Get Worker complete status;
	 *           * Verify if the storage directory is "null"
	 *   26. Verify if the "storageRoot/mgPublicKey2Hash" directory does not exist
	 *   27. A client with the public key "mgPublicKey2" sends a startWork message;
	 *           * Verify if the following info message was logged: Worker is ready to start working for client [ClientID2].
 	 *           * Expect the Worker to send the client a Worker is Ready message
	 *   28. Verify if the "storageRoot/mgPublicKey2Hash" directory exists
	 *   29. Get Worker complete status;
	 *           * Verify if the storage directory is "storageRoot/mgPublicKey2Hash"
	 *   30. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "." file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash" and md5sum "0"
	 *   31. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "$STORAGE" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash" and md5sum "0"
	 *   32. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "/etc/hosts" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash/etc/hosts]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash/etc/hosts" and md5sum "0"
	 *   33. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "$STORAGE/root/.bashrc" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash/root/.bashrc]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash/root/.bashrc" and md5sum "0"
	 *   34. Get Worker complete status;
	 *           * Verify if the storage directory is "storageRoot/mgPublicKey2Hash"
	 *   35. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "test_082_1.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash/test_082_1.txt]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash/test_082_1.txt" and md5sum "0"
	 *   36. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "$STORAGE/test_082_1.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash/test_082_1.txt]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash/test_082_1.txt" and md5sum "0"
	 *   37. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "test_082_2.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash/test_082_2.txt]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash/test_082_2.txt" and md5sum "0"
	 *   38. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "$STORAGE/test_082_2.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash/test_082_2.txt]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash/test_082_2.txt" and md5sum "0"
	 *   39. Copy the file test_082_2.txt, with md5sum value "Y", to "storageRoot/mgPublicKey2Hash" directory
	 *   40. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "$STORAGE/test_082_2.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash/test_082_2.txt]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash/test_082_2.txt" and md5sum "Y"
	 *   41. Get Worker complete status;
	 *           * Verify if the storage directory is "storageRoot/mgPublicKey2Hash"
	 *   42. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "test_082_2.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash/test_082_2.txt]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash/test_082_2.txt" and md5sum "Y"
	 *   43. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "test_082_1.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash/test_082_1.txt]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash/test_082_1.txt" and md5sum "0"
	 *   44. The master peer sends a stopWorking message to the Worker;
	 *           * Verify if the following info message was logged: "This Worker was commanded to stop working for the current client."
	 *           * Verify if the following debug message was logged: "Cleaning Worker."
	 *           * Verify if the following debug message was logged: "Status changed from ALLOCATED_FOR_MYGRID to IDLE."
	 *           * Expect the Worker to send a status changed message to the peer, with the IDLE status
	 *   45. Get Worker complete status;
	 *           * Verify if the storage directory is "null"
	 *   46. Verify if the "storageRoot/mgPublicKey2Hash" directory still exists
	 *   47. The master peer commands the Worker to work for the client with the public key "mgPublicKey1";
	 *           * Verify if the following info message was logged: "Peer commanded this Worker to work for a local consumer. Local consumer public key: [mgPublicKey1]."
	 *           * Verify if the following debug message was logged: "Status changed from IDLE to ALLOCATED_FOR_MYGRID."
	 *           * Expect the Worker to send the peer an allocated for mygrid status changed message, with a stub to the Worker remote object
	 *   48. Get Worker complete status;
	 *           * Verify if the storage directory is null
	 *   49. Verify if the "storageRoot/mgPublicKey1Hash" directory exists
	 *   50. A client with the public key "mgPublicKey1" sends a startWork message;
	 *           * Verify if the following info message was logged: Worker is ready to start working for client [ClientID1].
	 *           * Expect the Worker to send the client a Worker is Ready message
	 *   51. Verify if the "storageRoot/mgPublicKey1Hash" directory exists
	 *   52. Get Worker complete status;
	 *           * Verify if the storage directory is "storageRoot/mgPublicKey1Hash"
	 *   53. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "test_082_2.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/test_082_2.txt]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/test_082_2.txt" and md5sum "0"
	 *   54. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE/test_082_2.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/test_082_2.txt]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/test_082_2.txt" and md5sum "0"
	 *   55. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE/test_082_1.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/test_082_1.txt]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/test_082_1.txt" and md5sum "X"
	 *   56. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "test_082_1.txt" file;
 	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/test_082_1.txt]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/test_082_1.txt" and md5sum "X"
	 *   57. Get Worker complete status;
	 *           * Verify if the storage directory is "storageRoot/mgPublicKey1Hash"
	 *   58. The master peer sends again a setPeer message to the Worker;
     *           * Verify if the following warn message was logged: "The peer [peerID] set itself as manager of this Worker. This message was ignored. Because the master peer did not notify fail."
	 *   59. Get Worker complete status;
	 *           * Verify if the storage directory is "storageRoot/mgPublicKey1Hash"
	 *   60. Verify if the "storageRoot/mgPublicKey1Hash" directory still exists
	 *   61. Verify if the "storageRoot/mgPublicKey2Hash" directory still exists
	 *   62. Remove "storageRoot/mgPublicKey1Hash" and "storageRoot/mgPublicKey2Hash" directories
	 *   
	 */
	@ReqTest(test=" AT-082.5", reqs="REQ082")
	@Test public void test_at_082_5_ErrorWhileRecoveringFileInformationByLocalConsumer() throws Exception {
		long tickA = System.currentTimeMillis();

		// Start worker without idleness detector
		String storageRoot = WorkerAcceptanceUtil.DEF_STORAGE_ROOT_PATH;
		
		WorkerComponent component = req_004_Util.startWorker();
		
		// Master peer sends a setPeer message - expect an info to be logged
		WorkerManagementClient wmc = req_090_Util.setKnownPeer(component, peerID, WorkerStatus.IDLE);
		
		//getting file properties at worker.properties;
		Map<String, String> properties = component.getContainer().getContext().getProperties();

		//getting path dir
		String playpenDir = properties.get(WorkerConfiguration.ATT_PLAYPEN_ROOT);
		String storageDir = properties.get(WorkerConfiguration.ATT_STORAGE_DIR);

		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.IDLE, playpenDir, storageDir, tickA);
		
		// Master peer sends a workForMyGrid [mgPubKey1] message - expect an info and a debug to be logged
		String mgPubKey = "mgPubKey1";
		req_092_Util.workForMyGridOnIdleWorker(component, wmc, mgPubKey);
		Worker worker = req_092_Util.beginAllocationCompleted(component, wmc);
		
		// Verify if the directory [HashedMGPubKey] does NOT exist
		String hashedMGPubKey = WorkerAcceptanceUtil.generateHexadecimalCodedString(mgPubKey);
		String hasheadDir = storageRoot + System.getProperty("file.separator") + hashedMGPubKey;
		assertFalse(WorkerAcceptanceUtil.directoryExists(hasheadDir));
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.ALLOCATED_FOR_BROKER, playpenDir, storageDir, tickA);
		
		// Client [mgPubKey1] sends a startWork message - expect an info to be logged
		DeploymentID myGridID = new DeploymentID(new ContainerID("mgUserName", "mgServer", "mgModule", mgPubKey), "myGrid");
		WorkerClient workerClient = req_079_Util.startWorkSuccessfully(component, worker, myGridID);
		
		// Verify if the directory [HashedMGPubKey] EXISTS
		assertTrue(WorkerAcceptanceUtil.directoryExists(storageDir));
		
		storageDir += File.separator + WorkerAcceptanceUtil.generateHexadecimalCodedString(mgPubKey);
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.ALLOCATED_FOR_BROKER, playpenDir, storageDir, tickA);
		
		// Client [mgPubKey1] sends a getFileInfo [.] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient, mgPubKey, ".", storageDir,"0");
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient, mgPubKey,"$STORAGE", storageDir, "0");
		
		// Client [mgPubKey1] sends a getFileInfo [/etc/hosts] message - expect a debug to be logged
		String path = "/etc/hosts";
		req_082_Util.getFileInfoSuccessfully(component, workerClient, mgPubKey, path, storageDir + path, "0");
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE/root/.bashrc] message - expect a debug to be logged
		String path2 = "/root/.bashrc";
		req_082_Util.getFileInfoSuccessfully(component, workerClient, mgPubKey, "$STORAGE" + path2, storageDir + path2, "0");

		// Client [mgPubKey1] sends a getFileInfo [test_082_1.txt] message - expect a debug to be logged
		String file = "test_082_1.txt";
		String completePath = storageDir + System.getProperty("file.separator") + file;
		req_082_Util.getFileInfoSuccessfully(component, workerClient, mgPubKey, file, completePath, "0");

		// Client [mgPubKey1] sends a getFileInfo [$STORAGE/test_082_1.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient, mgPubKey, "$STORAGE/test_082_1.txt", completePath, "0");

		// Create file [test_082_1.txt] on [$STORAGE]
		assertTrue(WorkerAcceptanceUtil.createFile(completePath));
		String fileDigest = Req_082_Util.getFileDigest(completePath);
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE/test_082_1.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient, mgPubKey, "$STORAGE/test_082_1.txt", completePath, fileDigest);

		// Client [mgPubKey1] sends a getFileInfo [test_082_1.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient, mgPubKey, file, completePath, fileDigest);

		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.ALLOCATED_FOR_BROKER, playpenDir, storageDir, tickA);
		
		// Master peer sends a workForMyGrid [mgPubKey2] message - expect an info and a debug to be logged
		String mgPubKey2 = "mgPubKey2";
		req_092_Util.workForMyGridOnAllocatedForMyGridWorker(component, wmc, mgPubKey2);
		Worker worker2 = req_092_Util.beginAllocationCompleted(component, wmc);
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.ALLOCATED_FOR_BROKER, playpenDir, storageRoot, tickA);
		
		// Verify if [storageRoot/HashedMGPubKey] still exists
		assertTrue(WorkerAcceptanceUtil.directoryExists(storageDir));
		
		// Verify if the directory [storageRoot/HashedMG2PubKey] does NOT exist
		String hashedMG2PubKey = WorkerAcceptanceUtil.generateHexadecimalCodedString(mgPubKey2);
		
		String storageDir2 = properties.get(WorkerConfiguration.ATT_STORAGE_DIR)
		+ System.getProperty("file.separator") + hashedMG2PubKey;
		assertFalse(WorkerAcceptanceUtil.directoryExists(storageDir2));
		
		// Client [mgPubKey2] sends a getFileInfo [$STORAGE] message - expect a warn to be logged
		req_082_Util.getFileInfoByClientWithoutStartingWork(component, "$STORAGE", mgPubKey2);
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.ALLOCATED_FOR_BROKER, playpenDir, storageRoot, tickA);
		
		// Verify if the directory [storageRoot/HashedMG2PubKey] does NOT exist
		assertFalse(WorkerAcceptanceUtil.directoryExists(storageDir2));
		
		// Client [mgPubKey2] sends a startWork message - expect an info to be logged
		DeploymentID myGrid2ID = new DeploymentID(new ContainerID("mg2UserName", "mg2Server", "mg2Module", mgPubKey2), "myGrid2");
		
		WorkerClient workerClient2 = req_079_Util.startWorkSuccessfully(component, worker2, myGrid2ID);
		
		// Verify if the directory [storageRoot/HashedMG2PubKey] DOES exist
		assertTrue(WorkerAcceptanceUtil.directoryExists(storageDir2));
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.ALLOCATED_FOR_BROKER, playpenDir, storageDir2, tickA);
		
		// Client [mgPubKey2] sends a getFileInfo [.] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mgPubKey2, ".", storageDir2, "0");
		
		// Client [mgPubKey2] sends a getFileInfo [$STORAGE] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mgPubKey2, "$STORAGE", storageDir2, "0");
		
		// Client [mgPubKey2] sends a getFileInfo [/etc/hosts] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mgPubKey2, path, storageDir2 + path, "0");
		
		// Client [mgPubKey2] sends a getFileInfo [$STORAGE/root/.bashrc] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mgPubKey2, "$STORAGE" + path2, storageDir2 + path2, "0");

		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.ALLOCATED_FOR_BROKER, playpenDir, storageDir2, tickA);
		
		// Client [mgPubKey2] sends a getFileInfo [test_082_1.txt] message - expect a debug to be logged
		String completePath2 = storageDir2 + System.getProperty("file.separator") + file;
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mgPubKey2, file, completePath2, "0");

		// Client [mgPubKey2] sends a getFileInfo [$STORAGE/test_082_1.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mgPubKey2, "$STORAGE/test_082_1.txt", completePath2, "0");

		// Client [mgPubKey2] sends a getFileInfo [test_082_2.txt] message - expect a debug to be logged
		String file2 = "test_082_2.txt";
		String completePath3 = storageDir2 + System.getProperty("file.separator") + file2;
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mgPubKey2, file2, completePath3, "0");

		// Client [mgPubKey2] sends a getFileInfo [$STORAGE/test_082_2.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mgPubKey2, "$STORAGE/" + file2, completePath3, "0");
		
		// Create file [test_082_2.txt] on [$STORAGE]
		assertTrue(WorkerAcceptanceUtil.createFile(completePath3));
		String fileDigest2 = Req_082_Util.getFileDigest(completePath3);
		
		// Client [mgPubKey2] sends a getFileInfo [$STORAGE/test_082_2.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mgPubKey2, "$STORAGE/" + file2, completePath3, fileDigest2);
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.ALLOCATED_FOR_BROKER, playpenDir, storageDir2, tickA);
		
		// Client [mgPubKey2] sends a getFileInfo [test_082_2.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mgPubKey2, file2, completePath3, fileDigest2);
		
		// Client [mgPubKey2] sends a getFileInfo [test_082_1.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mgPubKey2, file, completePath2, "0");

		// Master peer sends stopWorking message - expect an info and two debugs to be logged
		req_091_Util.stopWorkingOnAllocatedForMyGridWorker(component, wmc, peerID.getPublicKey());
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.IDLE, playpenDir, storageRoot, tickA);
		
		// Verify if the directory [storageRoot/HashedMG2PubKey] DOES exist
		assertTrue(WorkerAcceptanceUtil.directoryExists(storageDir2));
		
		// Master peer sends workForMyGrid [mgPubKey1] message - expect an info and a debug to be logged
		req_092_Util.workForMyGridOnIdleWorker(component, wmc, mgPubKey);
		Worker worker3 = req_092_Util.beginAllocationCompleted(component, wmc);
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.ALLOCATED_FOR_BROKER, playpenDir, storageRoot, tickA);
		
		// Client [mgPubKey1] sends a startWork message - expect an info to be logged
		WorkerClient workerClient3 = req_079_Util.startWorkSuccessfully(component, worker3, myGridID);
		
		// Verify if the directory [HashedMGPubKey] EXISTS
		assertTrue(WorkerAcceptanceUtil.directoryExists(storageDir));
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.ALLOCATED_FOR_BROKER, playpenDir, storageDir, tickA);
		
		// Client [mgPubKey1] sends a getFileInfo [test_082_2.txt] message - expect a debug to be logged
		String completePath4 = storageDir + System.getProperty("file.separator") + file2;
		req_082_Util.getFileInfoSuccessfully(component, workerClient3, mgPubKey, file2, completePath4, "0");

		// Client [mgPubKey1] sends a getFileInfo [$STORAGE/test_082_2.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient3,  mgPubKey, "$STORAGE/" + file2, completePath4, "0");
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE/test_082_1.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient3, mgPubKey, "$STORAGE/" + file, completePath, fileDigest);
		
		// Client [mgPubKey1] sends a getFileInfo [test_082_1.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient3, mgPubKey, file, completePath, fileDigest);

		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.ALLOCATED_FOR_BROKER, playpenDir, storageDir, tickA);
		
		// Master peer sends setPeer message - expect a warn to be logged
		req_090_Util.setPeerByMasterPeerFromSameLocation(component, peerID, WorkerStatus.ALLOCATED_FOR_BROKER, wmc);
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID,
				WorkerStatus.ALLOCATED_FOR_BROKER, playpenDir, storageDir, tickA);
		
		// Verify if the directory [storageRoot/HashedMGPubKey] DOES exist
		assertTrue(WorkerAcceptanceUtil.directoryExists(storageDir));
		
		// Verify if the directory [storageRoot/HashedMG2PubKey] DOES exist
		assertTrue(WorkerAcceptanceUtil.directoryExists(storageDir2));
	}

	/**
	 *    1. Start a Worker with the idleness detector DISABLED;
	 *    2. The master peer sends a setPeer message to the Worker;
	 *           * Verify if the following info message was logged: The peer [peerID] set itself as manager of this Worker.
	 *           * Expect the Worker to send a status changed message to the peer, with the IDLE status
	 *    3. The master peer sends a workForPeer message to the Worker;
	 *           * Verify if the following info message was logged: "Peer commanded this Worker to work for a remote peer. Remote peer public key: [peerPubKey]."
	 *           * Verify if the following debug message was logged: "Status changed from IDLE to ALLOCATED_FOR_PEER."
	 *           * Expect the Worker to send the peer an allocated for peer status changed message, with a stub to the Remote Worker Management remote object
	 *    4. The remote peer with the public key "peerPubKey" commands the Worker to work for the remote client with the public key "mgPublicKey1";
 	 *           * Verify if the following info message was logged: "Remote peer commanded this Worker to work for a remote consumer. Remote consumer public key: [mgPublicKey1]."
	 *           * Verify if the following debug message was logged: "Status changed from ALLOCATED_FOR_PEER to ALLOCATED_FOR_MYGRID."
	 *           * Expect the Worker to send the remote peer an allocated for mygrid status changed message, with a stub to the Worker remote object
	 *    5. Verify if the "storageRoot/mgPublicKey1Hash" directory does not exist
	 *    6. Get Worker complete status;
	 *           * Verify if the storage directory is null
	 *    7. A client with the public key "mgPublicKey1" sends a startWork message;
	 *           * Verify if the following info message was logged: Worker is ready to start working for client [ClientID1].
	 *           * Expect the Worker to send the client a Worker is Ready message
	 *    8. Verify if the "storageRoot/mgPublicKey1Hash" directory exists
	 *    9. Get Worker complete status;
	 *           * Verify if the storage directory is "storageRoot/mgPublicKey1Hash"
	 *   10. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "." file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash" and md5sum "0"
	 *   11. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash" and md5sum "0"
	 *   12. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "/etc/hosts" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/etc/hosts]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/etc/hosts" and md5sum "0"
	 *   13. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE/root/.bashrc" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/root/.bashrc]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/root/.bashrc" and md5sum "0"
	 *   14. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "test_082_1.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/test_082_1.txt]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/test_082_1.txt" and md5sum "0"
	 *   15. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE/test_082_1.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/test_082_1.txt]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/test_082_1.txt" and md5sum "0"
	 *   16. Copy the file test_082_1.txt, with md5sum value "X", to storageRoot/mgPublicKey1Hash directory
	 *   17. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE/test_082_1.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/test_082_1.txt]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/test_082_1.txt" and md5sum "X"
	 *   18. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "test_082_1.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/test_082_1.txt]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/test_082_1.txt" and md5sum "X"
	 *   19. Get Worker complete status;
	 *           * Verify if the storage directory is "storageRoot/mgPublicKey1Hash"
	 *   20. The remote peer with the public key "peerPubKey" commands the Worker to work for the remote client with the public key "mgPublicKey2";
	 *           * Verify if the following info message was logged: "Remote peer commanded this Worker to work for a remote consumer. Remote consumer public key: [mgPublicKey2]."
	 *           * Verify if the following debug message was logged: "Cleaning worker."
	 *           * Expect the Worker to send the remote peer an allocated for mygrid status changed message, with a stub to the Worker remote object
	 *   21. Get Worker complete status;
	 *           * Verify if the storage directory is "null"
	 *   22. Verify if the "storageRoot/mgPublicKey1Hash" directory still exists
	 *   23. Verify if the "storageRoot/mgPublicKey2Hash" directory does not exist
	 *   24. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "$STORAGE" file;
	 *           * Verify if the following debug message was logged: "The client requested info about the file [$STORAGE], but this Worker was not commanded to start the work yet. This message was ignored. Client public key: [mgPublicKey1]."
	 *   25. Get Worker complete status;
	 *           * Verify if the storage directory is "null"
	 *   26. Verify if the "storageRoot/mgPublicKey2Hash" directory does not exist
	 *   27. A client with the public key "mgPublicKey2" sends a startWork message;
	 *           * Verify if the following info message was logged: Worker is ready to start working for client [ClientID2].
	 *           * Expect the Worker to send the client a Worker is Ready message
	 *   28. Verify if the "storageRoot/mgPublicKey2Hash" directory exists
	 *   29. Get Worker complete status;
	 *           * Verify if the storage directory is "storageRoot/mgPublicKey2Hash"
	 *   30. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "." file;
 	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash" and md5sum "0"
	 *   31. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "$STORAGE" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash" and md5sum "0"
	 *   32. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "/etc/hosts" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash/etc/hosts]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash/etc/hosts" and md5sum "0"
	 *   33. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "$STORAGE/root/.bashrc" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash/root/.bashrc]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash/root/.bashrc" and md5sum "0"
	 *   34. Get Worker complete status;
	 *           * Verify if the storage directory is "storageRoot/mgPublicKey2Hash"
	 *   35. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "test_082_1.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash/test_082_1.txt]. Client public key: [mgPublicKey2]"
 	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash/test_082_1.txt" and md5sum "0"
	 *   36. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "$STORAGE/test_082_1.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash/test_082_1.txt]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash/test_082_1.txt" and md5sum "0"
	 *   37. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "test_082_2.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash/test_082_2.txt]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash/test_082_2.txt" and md5sum "0"
	 *   38. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "$STORAGE/test_082_2.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash/test_082_2.txt]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash/test_082_2.txt" and md5sum "0"
	 *   39. Copy the file test_082_2.txt, with md5sum value "Y", to "storageRoot/mgPublicKey2Hash" directory
	 *   40. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "$STORAGE/test_082_2.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash/test_082_2.txt]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash/test_082_2.txt" and md5sum "Y"
	 *   41. Get Worker complete status;
	 *           * Verify if the storage directory is "storageRoot/mgPublicKey2Hash"
	 *   42. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "test_082_2.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash/test_082_2.txt]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash/test_082_2.txt" and md5sum "Y"
	 *   43. A client with the public key "mgPublicKey2" sends a getFileInfo message, requesting info about the "test_082_1.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey2Hash/test_082_1.txt]. Client public key: [mgPublicKey2]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey2Hash/test_082_1.txt" and md5sum "0"
	 *   44. The master peer sends a stopWorking message to the Worker;
	 *           * Verify if the following info message was logged: "This Worker was commanded to stop working for the current client."
	 *           * Verify if the following debug message was logged: "Cleaning Worker."
	 *           * Verify if the following debug message was logged: "Status changed from ALLOCATED_FOR_MYGRID to IDLE."
	 *           * Expect the Worker to send a status changed message to the peer, with the IDLE status
	 *   45. Get Worker complete status;
	 *           * Verify if the storage directory is "null"
	 *   46. Verify if the "storageRoot/mgPublicKey2Hash" directory still exists
	 *   47. The master peer sends a workForPeer message to the Worker;
	 *           * Verify if the following info message was logged: "Peer commanded this Worker to work for a remote peer. Remote peer public key: [peerPubKey]."
	 *           * Verify if the following debug message was logged: "Status changed from IDLE to ALLOCATED_FOR_PEER."
	 *           * Expect the Worker to send the peer an allocated for peer status changed message, with a stub to the Remote Worker Management remote object
	 *   48. The remote peer with the public key "peerPubKey" commands the Worker to work for the remote client with the public key "mgPublicKey1";
	 *           * Verify if the following info message was logged: "Remote peer commanded this Worker to work for a remote consumer. Remote consumer public key: [mgPublicKey1]."
	 *           * Verify if the following debug message was logged: "Status changed from ALLOCATED_FOR_PEER to ALLOCATED_FOR_MYGRID."
	 *           * Expect the Worker to send the remote peer an allocated for mygrid status changed message, with a stub to the Worker remote object
	 *   49. The master peer commands the Worker to work for the client with the public key "mgPublicKey1";
	 *           * Verify if the following info message was logged: "Peer commanded this Worker to work for a local consumer. Local consumer public key: [mgPublicKey1]."
	 *           * Verify if the following debug message was logged: "Status changed from IDLE to ALLOCATED_FOR_MYGRID."
	 *           * Expect the Worker to send the peer an allocated for mygrid status changed message, with a stub to the Worker remote object
	 *   50. Get Worker complete status;
	 *           * Verify if the storage directory is null
	 *   51. Verify if the "storageRoot/mgPublicKey1Hash" directory exists
	 *   52. A client with the public key "mgPublicKey1" sends a startWork message;
 	 *           * Verify if the following info message was logged: Worker is ready to start working for client [ClientID1].
	 *           * Expect the Worker to send the client a Worker is Ready message
	 *   53. Verify if the "storageRoot/mgPublicKey1Hash" directory exists
	 *   54. Get Worker complete status;
	 *           * Verify if the storage directory is "storageRoot/mgPublicKey1Hash"
	 *   55. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "test_082_2.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/test_082_2.txt]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/test_082_2.txt" and md5sum "0"
 	 *   56. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE/test_082_2.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/test_082_2.txt]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/test_082_2.txt" and md5sum "0"
	 *   57. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE/test_082_1.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/test_082_1.txt]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/test_082_1.txt" and md5sum "X"
	 *   58. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "test_082_1.txt" file;
	 *           * Verify if the following debug message was logged: "Client successfully got file info. File: [storageRoot/mgPublicKey1Hash/test_082_1.txt]. Client public key: [mgPublicKey1]"
	 *           * Expect the Worker to return to the client information about the file, with file path "storageRoot/mgPublicKey1Hash/test_082_1.txt" and md5sum "X"
	 *   59. Get Worker complete status;
	 *           * Verify if the storage directory is "storageRoot/mgPublicKey1Hash"
	 *   60. The master peer sends again a setPeer message to the Worker;
     *           * Verify if the following warn message was logged: "The peer [peerID] set itself as manager of this Worker. This message was ignored. Because the master peer did not notify fail."
	 *   61. Get Worker complete status;
	 *           * Verify if the storage directory is "storageRoot/mgPublicKey1Hash"
	 *   62. Verify if the "storageRoot/mgPublicKey1Hash" directory still exists
 	 *   63. Verify if the "storageRoot/mgPublicKey2Hash" directory still exists
	 *   64. Remove "storageRoot/mgPublicKey1Hash" and "storageRoot/mgPublicKey2Hash" directories
	 *   
	 */
	@ReqTest(test=" AT-082.6", reqs="REQ082")
	@Test public void test_at_082_6_ErrorWhileRecoveringFileInformationByRemoteConsumer() throws Exception {
		// Start worker without idleness detector
		long tickA = System.currentTimeMillis();
		String storageRoot = WorkerAcceptanceUtil.DEF_STORAGE_ROOT_PATH;
		
		WorkerComponent component = req_004_Util.startWorker();
		
		//getting file properties at worker.properties;
		Map<String, String> properties = component.getContainer().getContext().getProperties();

		// Master peer sends a setPeer message - expect an info to be logged
		WorkerManagementClient wmc = req_090_Util.setKnownPeer(component, peerID, WorkerStatus.IDLE);
		
		// Master peer sends a workForPeer [peerPubKey] message - expect an info and a debug to be logged
		String remPeerPubKey = "peerPubKey";
		req_006_Util.workForPeerOnIdleWorker(component, wmc, peerID.getPublicKey(), remPeerPubKey);
		
		// Remote peer [peerPubKey] sends a workForMyGrid [mgPubKey1] message - expect an info and a debug to be logged
		String mgPubKey = "mgPubKey1";
		RemoteWorkerManagementClient rwmc = req_121_Util.workForMyGridOnAllocatedForPeerWorker(component, remPeerPubKey, mgPubKey);
		Worker worker = req_121_Util.beginAllocationCompleted(component, rwmc);
		
		//getting path dir
		String playpenDir = properties.get(WorkerConfiguration.ATT_PLAYPEN_ROOT);
		String storageDir = properties.get(WorkerConfiguration.ATT_STORAGE_DIR);

		// Verify if the directory [storageRoot/HashedMGPubKey1] does NOT exist
		String hashedMGPubKey = WorkerAcceptanceUtil.generateHexadecimalCodedString(mgPubKey);
		storageDir += System.getProperty("file.separator") + hashedMGPubKey;
		assertFalse(WorkerAcceptanceUtil.directoryExists(storageDir));
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID, WorkerStatus.ALLOCATED_FOR_BROKER, playpenDir, storageRoot, tickA);
		
		// Client [mgPubKey1] sends a startWork message - expect an info to be logged
		DeploymentID myGridID = new DeploymentID(new ContainerID("mgUserName", "mgServer", "mgModule", mgPubKey), "myGrid");
		
		WorkerClient workerClient = req_079_Util.startWorkSuccessfully(component, worker, myGridID);
		
		// Verify if the directory [storageRoot/HashedMGPubKey1] does EXIST
		assertTrue(WorkerAcceptanceUtil.directoryExists(storageDir));
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID, WorkerStatus.ALLOCATED_FOR_BROKER, 
				playpenDir, storageDir, tickA);
		
		// Client [mgPubKey1] sends a getFileInfo [.] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient, mgPubKey, ".", storageDir, "0");
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient, mgPubKey,  "$STORAGE", storageDir, "0");
		
		// Client [mgPubKey1] sends a getFileInfo [/etc/hosts] message - expect a debug to be logged
		String path1 = "/etc/hosts";
		req_082_Util.getFileInfoSuccessfully(component, workerClient, mgPubKey, path1, storageDir + path1, "0");
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE/root/.bashrc] message - expect a debug to be logged
		String path2 = "/root/.bashrc";
		req_082_Util.getFileInfoSuccessfully(component, workerClient, mgPubKey, "$STORAGE" + path2, storageDir + path2, "0");
		
		// Client [mgPubKey1] sends a getFileInfo [test_082_1.txt] message - expect a debug to be logged
		String fileName = "test_082_1.txt";
		String completePath = storageDir + System.getProperty("file.separator") + fileName;
		req_082_Util.getFileInfoSuccessfully(component, workerClient, mgPubKey, fileName, completePath, "0");
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE/test_082_1.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient, mgPubKey, "$STORAGE/" + fileName, completePath, "0");
		
		// Create file [test_082_1.txt] on [$STORAGE]
		assertTrue(WorkerAcceptanceUtil.createFile(completePath));
		String fileDigest = Req_082_Util.getFileDigest(completePath);
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE/test_082_1.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient, mgPubKey, "$STORAGE/" + fileName, completePath, fileDigest);
		
		// Client [mgPubKey1] sends a getFileInfo [test_082_1.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient, mgPubKey, fileName, completePath, fileDigest);
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID, WorkerStatus.ALLOCATED_FOR_BROKER, 
				playpenDir, storageDir, tickA);
		
		// Remote peer [peerPubKey] sends a workForMyGrid [mgPubKey2] message - expect an info and a debug to be logged
		String mg2PubKey = "mgPubKey2";
		rwmc = req_121_Util.workForMyGridOnAllocatedForMyGridWorker(component, remPeerPubKey, mg2PubKey);
		Worker worker2 = req_121_Util.beginAllocationCompleted(component, rwmc);
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID, WorkerStatus.ALLOCATED_FOR_BROKER, 
				playpenDir, storageRoot, tickA);
		
		// Verify if the directory [storageRoot/HashedMGPubKey1] still EXISTS
		assertTrue(WorkerAcceptanceUtil.directoryExists(storageDir));
		
		// Verify if the directory [storageRoot/HashedMGPubKey2] does NOT exist
		String hashedMG2PubKey = WorkerAcceptanceUtil.generateHexadecimalCodedString(mg2PubKey);
		String storageDir2 = properties.get(WorkerConfiguration.ATT_STORAGE_DIR)
			+ System.getProperty("file.separator") + hashedMG2PubKey;
		
		assertFalse(WorkerAcceptanceUtil.directoryExists(storageDir2));
		
		// Client [mgPubKey2] sends a getFileInfo [.] message - expect a debug to be logged
		req_082_Util.getFileInfoByClientWithoutStartingWork(component, ".", mg2PubKey);
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID, WorkerStatus.ALLOCATED_FOR_BROKER, 
				playpenDir, storageRoot, tickA);
		
		// Verify if the directory [storageRoot/HashedMGPubKey2] does NOT exist
		assertFalse(WorkerAcceptanceUtil.directoryExists(storageDir2));
		
		// Client [mgPubKey2] sends a startWork message - expect an info to be logged
		DeploymentID myGrid2ID = new DeploymentID(new ContainerID("mg2UserName", "mg2Server", "mg2Module", mg2PubKey), "myGrid2");
		
		WorkerClient workerClient2 = req_079_Util.startWorkSuccessfully(component, worker2, myGrid2ID);
		
		// Verify if the directory [storageRoot/HashedMGPubKey2] does EXIST
		assertTrue(WorkerAcceptanceUtil.directoryExists(storageDir2));
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID, WorkerStatus.ALLOCATED_FOR_BROKER, 
				playpenDir, storageDir2, tickA);
		
		// Client [mgPubKey2] sends a getFileInfo [.] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mg2PubKey,  ".", storageDir2, "0");
		
		// Client [mgPubKey2] sends a getFileInfo [$STORAGE] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mg2PubKey, "$STORAGE", storageDir2, "0");
		
		// Client [mgPubKey2] sends a getFileInfo [/etc/hosts] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mg2PubKey,path1, storageDir2 + path1, "0");
		
		// Client [mgPubKey2] sends a getFileInfo [$STORAGE/root/.bashrc] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mg2PubKey, "$STORAGE" + path2, storageDir2 + path2, "0");
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID, WorkerStatus.ALLOCATED_FOR_BROKER, 
				playpenDir, storageDir2, tickA);

		// Client [mgPubKey2] sends a getFileInfo [test_082_1.txt] message - expect a debug to be logged
		String completePath2 = storageDir2 + System.getProperty("file.separator") + fileName;
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mg2PubKey, fileName, completePath2, "0");
		
		// Client [mgPubKey2] sends a getFileInfo [$STORAGE/test_082_1.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mg2PubKey, "$STORAGE/" + fileName, completePath2, "0");
		
		// Client [mgPubKey2] sends a getFileInfo [test_082_2.txt] message - expect a debug to be logged
		String fileName2 = "test_082_2.txt";
		String completePath3 = storageDir2 + System.getProperty("file.separator") + fileName2;
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mg2PubKey, fileName2, completePath3, "0");
		
		// Client [mgPubKey2] sends a getFileInfo [$STORAGE/test_082_2.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mg2PubKey, "$STORAGE/" + fileName2, completePath3, "0");
		
		// Create file [test_082_2.txt] on [$STORAGE]
		assertTrue(WorkerAcceptanceUtil.createFile(completePath3));
		String fileDigest2 = Req_082_Util.getFileDigest(completePath3);
		
		// Client [mgPubKey2] sends a getFileInfo [$STORAGE/test_082_2.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mg2PubKey, "$STORAGE/" + fileName2, completePath3, fileDigest2);
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID, WorkerStatus.ALLOCATED_FOR_BROKER, 
				playpenDir, storageDir2, tickA);

		// Client [mgPubKey2] sends a getFileInfo [test_082_2.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mg2PubKey, fileName2,completePath3, fileDigest2);
		
		// Client [mgPubKey2] sends a getFileInfo [test_082_1.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient2, mg2PubKey, fileName, completePath2, "0");
		
		// Master peer sends stopWorking message - expect an info and two debugs to be logged
		req_091_Util.stopWorkingOnAllocatedForMyGridWorker(component, wmc, peerID.getPublicKey());
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID, WorkerStatus.IDLE, 
				playpenDir, storageRoot, tickA);
		
		// Master peer sends a workForPeer [peerPubKey] message - expect an info and a debug to be logged
		req_006_Util.workForPeerOnIdleWorker(component, wmc, peerID.getPublicKey(), remPeerPubKey);
		
		// Remote peer [peerPubKey] sends a workForMyGrid [mgPubKey1] message - expect an info and a debug to be logged
		rwmc = req_121_Util.workForMyGridOnAllocatedForPeerWorker(component, remPeerPubKey, mgPubKey);
		Worker worker3 = req_121_Util.beginAllocationCompleted(component, rwmc);
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID, WorkerStatus.ALLOCATED_FOR_BROKER, 
				playpenDir, storageRoot, tickA);
		
		// Verify if the directory [storageRoot/HashedMGPubKey1] still EXISTS
		assertTrue(WorkerAcceptanceUtil.directoryExists(storageDir));
		
		// Client [mgPubKey1] sends a startWork message - expect an info to be logged
		DeploymentID myGrid3ID = new DeploymentID(new ContainerID("mg3UserName", "mg3Server", "mg3Module", mgPubKey), "myGrid3");
		
		WorkerClient workerClient3 = req_079_Util.startWorkSuccessfully(component, worker3, myGrid3ID);
		
		// Verify if the directory [storageRoot/HashedMGPubKey1] still EXISTS
		assertTrue(WorkerAcceptanceUtil.directoryExists(storageDir));

		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID, WorkerStatus.ALLOCATED_FOR_BROKER, 
				playpenDir, storageDir, tickA);
		
		// Client [mgPubKey1] sends a getFileInfo [test_082_2.txt] message - expect a debug to be logged
		String completePath4 = storageDir + System.getProperty("file.separator") + fileName2;
		req_082_Util.getFileInfoSuccessfully(component, workerClient3, mgPubKey, fileName2, completePath4, "0");
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE/test_082_2.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient3, mgPubKey, "$STORAGE/" + fileName2, completePath4, "0");
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE/test_082_1.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient3, mgPubKey, "$STORAGE/" + fileName, completePath, fileDigest);
		
		// Client [mgPubKey1] sends a getFileInfo [test_082_1.txt] message - expect a debug to be logged
		req_082_Util.getFileInfoSuccessfully(component, workerClient3, mgPubKey, fileName, completePath, fileDigest);
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID, WorkerStatus.ALLOCATED_FOR_BROKER, 
				playpenDir, storageDir, tickA);
		
		// Master peer sends a setPeer message again - expect an info and two debugs to be logged
		req_090_Util.setPeerByMasterPeerFromSameLocation(component, peerID, WorkerStatus.ALLOCATED_FOR_BROKER, wmc);
		
		// Get worker's complete status
		req_095_Util.getCompleteStatus(component, peerID, WorkerStatus.ALLOCATED_FOR_BROKER,
				playpenDir, storageDir, tickA);
		
		// Verify if the directory [storageRoot/HashedMGPubKey1] still EXISTS
		assertTrue(WorkerAcceptanceUtil.directoryExists(storageDir));
		
		// Verify if the directory [storageRoot/HashedMGPubKey2] still EXISTS
		assertTrue(WorkerAcceptanceUtil.directoryExists(storageDir2));
	}

	/**
	 *    1. Start a Worker with the idleness detector DISABLED;
	 *    2. The master peer sends a setPeer message to the Worker;
	 *           * Verify if the following info message was logged: The peer [peerID] set itself as manager of this Worker.
	 *           * Expect the Worker to send a status changed message to the peer, with the IDLE status
	 *    3. The master peer commands the Worker to work for the client with the public key "mgPublicKey1";
	 *           * Verify if the following info message was logged: "Peer commanded this Worker to work for a local consumer. Local consumer public key: [mgPublicKey1]."
	 *           * Verify if the following debug message was logged: "Status changed from IDLE to ALLOCATED_FOR_MYGRID."
	 *           * Expect the Worker to send the peer an allocated for mygrid status changed message, with a stub to the Worker remote object
	 *    4. A client with the public key "mgPublicKey1" sends a startWork message;
	 *           * Verify if the following info message was logged: Worker is ready to start working for client [ClientID1].
	 *           * Expect the Worker to send the client a Worker is Ready message
	 *    5. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "null" file;
	 *           * Verify if the following info message was logged: "Error occurred while trying to get file INFO. File: [null]. Client public key: [mgPublicKey1]. Cause: [File path is null.]."
	 *           * Expect the Worker to send the client an error ocurred message with the APPLICATION_ERROR type
	 *    6. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$ABC/temp" file;
	 *           * Verify if the following warn message was logged: "Error occurred while trying to get file INFO. File: [$ABC/temp]. Client public key: [mgPublicKey1]. Cause: [Invalid variable found.]."
	 *    7. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$PLAYPEN/temp" file;
	 *           * Verify if the following warn message was logged: "Error occurred while trying to get file INFO. File: [$PLAYPEN/temp]. Client public key: [mgPublicKey1]. Cause: [Invalid variable found.]."
	 *           * Expect the Worker to send the client an error ocurred message with the APPLICATION_ERROR type
	 *    8. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE/$PLAYPEN/" file;
	 *           * Verify if the following warn message was logged: "Error occurred while trying to get file INFO. File: [$STORAGE/$PLAYPEN/]. Client public key: [mgPublicKey1]. Cause: [Invalid variable found.]."
	 *           * Expect the Worker to send the client an error ocurred message with the APPLICATION_ERROR type
	 *    9. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE/../../system" file;
	 *           * Verify if the following warn message was logged: "Error occurred while trying to get file INFO. File: [$STORAGE/../../system]. Client public key: [mgPublicKey1]. Cause: [File path is not relative to storage directory.]."
	 *           * Expect the Worker to send the client an error ocurred message with the APPLICATION_ERROR type
	 *   10. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "../../system" file;
	 *           * Verify if the following warn message was logged: "Error occurred while trying to get file INFO. File: [../../system]. Client public key: [mgPublicKey1]. Cause: [File path is not relative to storage directory.]."
	 *           * Expect the Worker to send the client an error ocurred message with the APPLICATION_ERROR type
	 *   11. Create the file $STORAGE/temp and make the file unreadable
	 *   12. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "temp" file;
	 *           * Verify if the following warn message was logged: "Error occurred while trying to get file INFO. File: [temp]. Client public key: [mgPublicKey1]. Cause: [File cannot be read.]."
	 *   13. Delete $STORAGE/temp
	 *   
	 */
	@ReqTest(test=" AT-082.7", reqs="REQ082")
	@Test public void test_at_082_7_FileInformationRecoveredSuccessfullyByLocalConsumer() throws Exception {
		// Start worker without idleness detector
		String storageRoot = WorkerAcceptanceUtil.DEF_STORAGE_ROOT_PATH;
		WorkerComponent component = req_004_Util.startWorker();
		
		//getting file properties at worker.properties;
		Map<String, String> properties = component.getContainer().getContext().getProperties();
		
		// Master peer sends a setPeer message - expect an info to be logged
		WorkerManagementClient wmc = req_090_Util.setKnownPeer(component, peerID, WorkerStatus.IDLE);
		
		// Master peer sends a workForMyGrid [mgPubKey1] message - expect an info and a debug to be logged
		String mgPubKey = "mgPubKey1";
		req_092_Util.workForMyGridOnIdleWorker(component, wmc, mgPubKey);
		Worker worker = req_092_Util.beginAllocationCompleted(component, wmc);
		
		// Client [mgPubKey1] sends a startWork message - expect an info to be logged
		DeploymentID myGridID = new DeploymentID(new ContainerID("mgUserName", "mgServer", "mgModule", mgPubKey), "myGrid");
		
		WorkerClient workerClient = req_079_Util.startWorkSuccessfully(component, worker, myGridID);
		
		// Client [mgPubKey1] sends a getFileInfo [null] message - expect a warn to be logged
		req_082_Util.getNullFileInfo(component, workerClient, myGridID.getPublicKey());
		
		// Client [mgPubKey1] sends a getFileInfo [$ABC/temp] message - expect a warn to be logged
		req_082_Util.getFilePathInfoWithInvalidVariable(component, workerClient, myGridID.getPublicKey(), "$ABC/temp");
		
		// Client [mgPubKey1] sends a getFileInfo [$PLAYPEN/temp] message - expect a warn to be logged
		req_082_Util.getFilePathInfoWithInvalidVariable(component, workerClient, myGridID.getPublicKey(), "$PLAYPEN/temp");
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE/$PLAYPEN] message - expect a warn to be logged
		req_082_Util.getFilePathInfoWithInvalidVariable(component, workerClient, myGridID.getPublicKey(), "$STORAGE/$PLAYPEN");
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE/../../system] message - expect a warn to be logged
		String hashedMGPubKey = WorkerAcceptanceUtil.generateHexadecimalCodedString("mgPubKey1");
		
		//getting path dir
		String storageDir = properties.get(WorkerConfiguration.ATT_STORAGE_DIR) + 
		System.getProperty("file.separator") + hashedMGPubKey;
		storageDir = new File(storageDir).getAbsolutePath();
		req_082_Util.getFileInfoForNotRelativeFilePath(component, workerClient, myGridID.getPublicKey(), "$STORAGE/../../system", storageDir);
		
		// Client [mgPubKey1] sends a getFileInfo [../../system] message - expect a warn to be logged
		req_082_Util.getFileInfoForNotRelativeFilePath(component, workerClient, myGridID.getPublicKey(), "../../system", storageDir);
		
		// Create [$STORAGE/temp] and make it unreadable
		String newDirectory = storageDir + System.getProperty("file.separator") + "tempUnredeble";
		File file = WorkerAcceptanceUtil.createDirectory(newDirectory, false);
		
		if(JavaFileUtil.setNonReadable(file)){
			// Client [mgPubKey1] sends a getFileInfo [$STORAGE/temp] message - expect a warn to be logged
			req_082_Util.getUnreadableFileInfo(component, workerClient, myGridID.getPublicKey(), "$STORAGE"+File.separator+"tempUnredeble");
		}
		
		//Delete $STORAGE/temp
		file.delete();
	}

	/**
	 *    1. Start a Worker with the idleness detector DISABLED;
	 *    2. The master peer sends a setPeer message to the Worker;
	 *           * Verify if the following info message was logged: The peer [peerID] set itself as manager of this Worker.
	 *           * Expect the Worker to send a status changed message to the peer, with the IDLE status
	 *    3. The master peer sends a workForPeer message to the Worker;
 	 *           * Verify if the following info message was logged: "Peer commanded this Worker to work for a remote peer. Remote peer public key: [peerPubKey]."
	 *           * Verify if the following debug message was logged: "Status changed from IDLE to ALLOCATED_FOR_PEER."
 	 *           * Expect the Worker to send the peer an allocated for peer status changed message, with a stub to the Remote Worker Management remote object
	 *    4. The remote peer with the public key "peerPubKey" commands the Worker to work for the remote client with the public key "mgPublicKey1";
 	 *           * Verify if the following info message was logged: "Remote peer commanded this Worker to work for a remote consumer. Remote consumer public key: [mgPublicKey1]."
	 *           * Verify if the following debug message was logged: "Status changed from ALLOCATED_FOR_PEER to ALLOCATED_FOR_MYGRID."
	 *           * Expect the Worker to send the remote peer an allocated for mygrid status changed message, with a stub to the Worker remote object
	 *    5. A client with the public key "mgPublicKey1" sends a startWork message;
	 *           * Verify if the following info message was logged: Worker is ready to start working for client [ClientID1].
	 *           * Expect the Worker to send the client a Worker is Ready message
	 *    6. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "null" file;
	 *           * Verify if the following info message was logged: "Error occurred while trying to get file INFO. File: [null]. Client public key: [mgPublicKey1]. Cause: [File path is null.]."
	 *           * Expect the Worker to send the client an error ocurred message with the APPLICATION_ERROR type
	 *    7. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$ABC/temp" file;
	 *           * Verify if the following warn message was logged: "Error occurred while trying to get file INFO. File: [$ABC/temp]. Client public key: [mgPublicKey1]. Cause: [Invalid variable found.]."
	 *    8. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$PLAYPEN/temp" file;
	 *           * Verify if the following warn message was logged: "Error occurred while trying to get file INFO. File: [$PLAYPEN/temp]. Client public key: [mgPublicKey1]. Cause: [Invalid variable found.]."
 	 *           * Expect the Worker to send the client an error ocurred message with the APPLICATION_ERROR type
	 *    9. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE/$PLAYPEN/" file;
	 *           * Verify if the following warn message was logged: "Error occurred while trying to get file INFO. File: [$STORAGE/$PLAYPEN/]. Client public key: [mgPublicKey1]. Cause: [Invalid variable found.]."
	 *           * Expect the Worker to send the client an error ocurred message with the APPLICATION_ERROR type
	 *   10. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "$STORAGE/../../system" file;
	 *           * Verify if the following warn message was logged: "Error occurred while trying to get file INFO. File: [$STORAGE/../../system]. Client public key: [mgPublicKey1]. Cause: [File path is not relative to storage directory.]."
	 *           * Expect the Worker to send the client an error ocurred message with the APPLICATION_ERROR type
	 *   11. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "../../system" file;
	 *           * Verify if the following warn message was logged: "Error occurred while trying to get file INFO. File: [../../system]. Client public key: [mgPublicKey1]. Cause: [File path is not relative to storage directory.]."
	 *           * Expect the Worker to send the client an error ocurred message with the APPLICATION_ERROR type
	 *   12. Create the file $STORAGE/temp and make the file unreadable
	 *   13. A client with the public key "mgPublicKey1" sends a getFileInfo message, requesting info about the "temp" file;
	 *           * Verify if the following warn message was logged: "Error occurred while trying to get file INFO. File: [temp]. Client public key: [mgPublicKey1]. Cause: [File cannot be read.]."
	 *   14. Delete $STORAGE/temp
	 *   
	 */
	@ReqTest(test=" AT-082.8", reqs="REQ082")
	@Test public void test_at_082_8_FileInformationRecoveredSuccessfullyByRemoteConsumer() throws Exception {
		// Start worker without idleness detector
		String storageRoot = WorkerAcceptanceUtil.DEF_STORAGE_ROOT_PATH;
		WorkerComponent component = req_004_Util.startWorker();

		//getting file properties at worker.properties;
		Map<String, String> properties = component.getContainer().getContext().getProperties();

		// Master peer sends a setPeer message - expect an info to be logged
		WorkerManagementClient wmc = req_090_Util.setKnownPeer(component, peerID, WorkerStatus.IDLE);
		
		// Master peer sends a workForPeer [peerPubKey] message - expect an info and a debug to be logged
		String remPeerPubKey = "peerPubKey";
		req_006_Util.workForPeerOnIdleWorker(component, wmc, peerID.getPublicKey(), remPeerPubKey);
		
		// Remote peer [peerPubKey] sends a workForMyGrid [mgPubKey1] message - expect an info and a debug to be logged
		String mgPubKey = "mgPubKey1";
		RemoteWorkerManagementClient rwmc = req_121_Util.workForMyGridOnAllocatedForPeerWorker(component, remPeerPubKey, mgPubKey);
		Worker worker = req_121_Util.beginAllocationCompleted(component, rwmc);

		// Client [mgPubKey1] sends a startWork message - expect an info to be logged
		DeploymentID myGridID = new DeploymentID(new ContainerID("mgUserName", "mgServer", "mgModule", mgPubKey), "myGrid");
		WorkerClient workerClient = req_079_Util.startWorkSuccessfully(component, worker, myGridID);
		
		// Client [mgPubKey1] sends a getFileInfo [null] message - expect a warn to be logged
		req_082_Util.getNullFileInfo(component, workerClient, myGridID.getPublicKey());
		
		// Client [mgPubKey1] sends a getFileInfo [$ABC/temp] message - expect a warn to be logged
		req_082_Util.getFilePathInfoWithInvalidVariable(component, workerClient, myGridID.getPublicKey(), "$ABC/temp");
		
		// Client [mgPubKey1] sends a getFileInfo [$PLAYPEN/temp] message - expect a warn to be logged
		req_082_Util.getFilePathInfoWithInvalidVariable(component, workerClient, myGridID.getPublicKey(), "$PLAYPEN/temp");
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE/$PLAYPEN] message - expect a warn to be logged
		req_082_Util.getFilePathInfoWithInvalidVariable(component, workerClient, myGridID.getPublicKey(), "$STORAGE/$PLAYPEN");
		
		// Client [mgPubKey1] sends a getFileInfo [$STORAGE/../../system] message - expect a warn to be logged
		String hashedMGPubKey = WorkerAcceptanceUtil.generateHexadecimalCodedString("mgPubKey1");
		
		//getting path dir
		String storageDir = properties.get(WorkerConfiguration.ATT_STORAGE_DIR) + 
		System.getProperty("file.separator") + hashedMGPubKey;
		storageDir = new File(storageDir).getAbsolutePath();
		req_082_Util.getFileInfoForNotRelativeFilePath(component, workerClient, myGridID.getPublicKey(), "$STORAGE/../../system", storageDir);
		
		// Client [mgPubKey1] sends a getFileInfo [../../system] message - expect a warn to be logged
		req_082_Util.getFileInfoForNotRelativeFilePath(component, workerClient, myGridID.getPublicKey(), "../../system", storageDir);
		
		// Create [$STORAGE/temp] and make it unreadable
		String newDirectory = storageDir + System.getProperty("file.separator") + "temp";
		File file = WorkerAcceptanceUtil.createDirectory(newDirectory, false);
		
		if(JavaFileUtil.setNonReadable(file)){
			// Client [mgPubKey1] sends a getFileInfo [$STORAGE/temp] message - expect a warn to be logged
			req_082_Util.getUnreadableFileInfo(component, workerClient, myGridID.getPublicKey(), "$STORAGE/temp");
		}
		//Delete $STORAGE/temp
		file.delete();

	}
	
}